package TeacherEvaluation.com.controller;

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import TeacherEvaluation.com.entity.ClassInfo;
import TeacherEvaluation.com.entity.ResultMsg;
import TeacherEvaluation.com.service.readExcel;
/**
 * 上传文件所用控制器
 * @author azhao
 *2019/09/25
 */
@Controller
public class standardController {
	@Autowired
	private readExcel readexcel;
	
	//访问文件上传页面
	@RequestMapping("/addFile")
	public ModelAndView addfile() {
		ModelAndView mv = new ModelAndView("addfile");
		return mv;
	}
	
	//访问文件上传页面
		@RequestMapping("/addStandard")
		public ModelAndView addStandard() {
			ModelAndView mv = new ModelAndView("admin/testPaper/addStandard");
			return mv;
		}
	//文件上传提交 控制器
	@RequestMapping("/addFile_submit")
	public ResultMsg addfile_submit(String fileName) throws IOException {
		System.out.println(fileName);
		String fileName1="D:\\exceltest\\question.xlsx";
		int i = readexcel.readXLSX(fileName1);
		if(i==0) {
			return new ResultMsg(1, "信息录入成功");
		}else {
			return new ResultMsg(0, "信息录入失败");
		}
		
	}

}
